package android.textIt.backend.model;

import java.io.Serializable;
import java.util.Date;

import android.database.Cursor;
import android.textIt.backend.database.DatabaseHelper;

public class Message implements Serializable {

  private static final long serialVersionUID = 2058011989636841724L;

  protected long id;

  protected Date sentDate;

  protected Date receivedDate;

  protected Date lifetime;

  protected User sender;

  protected Group receiver;

  protected String content;

  protected Status status;

  protected int reference_id = -1;

  public Message() {
  }

  public Message(Cursor c, DatabaseHelper helper) {
    super();
    id = c.getInt(0);
    content = c.getString(1);
    receiver = new Group(c.getInt(2));
    sender = new User(c.getInt(3));
    sentDate = new Date (c.getLong(4));
    receivedDate = new Date(c.getLong(5));
    lifetime = new Date(c.getLong(6));
    status = new Status(c.getInt(7));
    reference_id = c.getInt(8);
  }

  /**
   * @return the id
   */
  public long getId() {
    return id;
  }

  /**
   * @param id
   *          the id to set
   */
  public void setId(long id) {
    this.id = id;
  }

  /**
   * @return the sentDate
   */
  public Date getSentDate() {
    return sentDate;
  }

  /**
   * @param sentDate
   *          the sentDate to set
   */
  public void setSentDate(Date sentDate) {
    this.sentDate = sentDate;
  }

  /**
   * @return the receivedDate
   */
  public Date getReceivedDate() {
    return receivedDate;
  }

  /**
   * @param receivedDate
   *          the receivedDate to set
   */
  public void setReceivedDate(Date receivedDate) {
    this.receivedDate = receivedDate;
  }

  /**
   * @return the lifetime
   */
  public Date getLifetime() {
    return lifetime;
  }

  /**
   * @param lifetime
   *          the lifetime to set
   */
  public void setLifetime(Date lifetime) {
    this.lifetime = lifetime;
  }

  /**
   * @return the sender
   */
  public User getSender() {
    return sender;
  }

  /**
   * @param sender
   *          the sender to set
   */
  public void setSender(User sender) {
    this.sender = sender;
  }

  /**
   * @return the content
   */
  public String getContent() {
    return content;
  }

  /**
   * @param content
   *          the content to set
   */
  public void setContent(String content) {
    this.content = content;
  }

  /**
   * @return the status
   */
  public Status getStatus() {
    return status;
  }

  /**
   * @param status
   *          the status to set
   */
  public void setStatus(Status status) {
    this.status = status;
  }

  /**
   * @return the reference_id
   */
  public int getReference_id() {
    return reference_id;
  }

  /**
   * @param reference_id
   *          the reference_id to set
   */
  public void setReference_id(int reference_id) {
    this.reference_id = reference_id;
  }

  /**
   * @return the receiver
   */
  public Group getReceiver() {
    return receiver;
  }

  /**
   * @param receiver
   *          the receiver to set
   */
  public void setReceiver(Group receiver) {
    this.receiver = receiver;
  }

}
